import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AdmAssetBorrowVO, AdmAssetBorrowForm, AdmAssetBorrowQuery } from '@/api/general/administration/asset/borrow/types';

/**
 * 查询资产借用列表
 * @param query
 * @returns {*}
 */

export const listAdmAssetBorrow = (query?: AdmAssetBorrowQuery): AxiosPromise<AdmAssetBorrowVO[]> => {
  return request({
    url: '/system/admAssetBorrow/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询资产借用详细
 * @param id
 */
export const getAdmAssetBorrow = (id: string | number): AxiosPromise<AdmAssetBorrowVO> => {
  return request({
    url: '/system/admAssetBorrow/' + id,
    method: 'get'
  });
};

/**
 * 新增资产借用
 * @param data
 */
export const addAdmAssetBorrow = (data: AdmAssetBorrowForm) => {
  return request({
    url: '/system/admAssetBorrow',
    method: 'post',
    data: data
  });
};

/**
 * 修改资产借用
 * @param data
 */
export const updateAdmAssetBorrow = (data: AdmAssetBorrowForm) => {
  return request({
    url: '/system/admAssetBorrow',
    method: 'put',
    data: data
  });
};

/**
 * 删除资产借用
 * @param id
 */
export const delAdmAssetBorrow = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/admAssetBorrow/' + id,
    method: 'delete'
  });
};


/**
 * 查询资产借用成功列表
 * @param query
 * @returns {*}
 */
export const listAssetBorrowSuccess = (data: AdmAssetBorrowForm): AxiosPromise<AdmAssetBorrowVO[]> => {
  return request({
    url: '/system/admAssetBorrow/listAssetBorrowSuccess',
    method: 'post',
    data: data
  });
};
